package be.kuleuven.cs.mop.domain.model.impl;


import static org.junit.Assert.*;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import be.kuleuven.cs.mop.TestEnvironment;
import be.kuleuven.cs.mop.domain.exceptions.TaskManagerException;



public class FocusWorkAlgorithmTaskTypeTest {
	private static TestEnvironment ENV;
	
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {}
	
	@AfterClass
	public static void tearDownAfterClass() throws Exception {}
	
	@Before
	public void setUp() throws Exception {
		ENV = TestEnvironment.newInstance();
	}
	
	@After
	public void tearDown() throws Exception {}
	
	
	
	@Test(expected=NullPointerException.class)
	public void testConstructorInvalidNull1() {
		new FocusWorkAlgorithmTaskType(null, ENV.testTaskType);
	}
	

	@Test(expected=NullPointerException.class)
	public void testConstructorInvalidNull2() {
		new FocusWorkAlgorithmTaskType(ENV.user1, null);
	}
	
	
	@Test
	public void testConstructorValid() {
		new FocusWorkAlgorithmTaskType(ENV.user1, ENV.testTaskType);
	}
	
	@Test
	public void testExecuteEmptyCase() throws TaskManagerException {
		ENV.user1.createTask(
					new Schedule(ENV.datum1, ENV.datum2, ENV.duration),
					new HashSet<TaskImpl>(),
					new HashMap<String, Field>(),
					ENV.testTaskType);
		ENV.user1.createTask(
					new Schedule(ENV.datum3, ENV.datum2, (ENV.duration + 1)),
					new HashSet<TaskImpl>(),
					new HashMap<String, Field>(),
					ENV.testTaskType);
		
		final List<TaskImpl> focus =
			new FocusWorkAlgorithmTaskType(ENV.user1, ENV.testTaskType).execute();
		assertNotNull(focus);
		assertTrue(focus.isEmpty());
		
	}
	
	
}
